package com.example.appointment.repository;

import com.example.appointment.entity.Doctor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface DoctorRepository extends JpaRepository<Doctor, Long> {
    Page<Doctor> findByNameContainingAndDepartmentIdAndStatus(
        String name,
        Long departmentId,
        Boolean status,
        Pageable pageable
    );
    
    Page<Doctor> findByNameContainingAndStatus(
        String name,
        Boolean status,
        Pageable pageable
    );
    
    Page<Doctor> findByDepartmentIdAndStatus(
        Long departmentId,
        Boolean status,
        Pageable pageable
    );
    
    List<Doctor> findByDepartmentId(Long departmentId);
    
    boolean existsByNameAndDepartmentId(String name, Long departmentId);

    Optional<Doctor> findByUserId(Long userId);
} 